
#ifndef __MAIN_H__
#define __MAIN_H__
#include"Game.h"
#include<ANX\ANX.h>
#include<ANXLib.h>
LRESULT CALLBACK WinCallBack(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
#pragma comment(lib, "ANXLib.lib")
int WINAPI WinMain(HINSTANCE h_instance,HINSTANCE,LPSTR,int)
{
	AllocConsole();
	FILE* fp = NULL;
	freopen_s(&fp,"CONOUT$","w",stdout);
	freopen_s(&fp,"CONIN$","r",stdin);


	WNDCLASS wnd_class;
	wnd_class = WNDCLASS();
	wnd_class.hInstance = h_instance;
	wnd_class.lpszClassName = "win";
	wnd_class.lpfnWndProc = WinCallBack;
	RegisterClass(&wnd_class);
	RECT rect = {0,0,WINDOW_X,WINDOW_Y};
	AdjustWindowRect(&rect,WS_OVERLAPPED,false);
	HWND hwnd = CreateWindow("win","ANXLaboratory",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,WINDOW_X,WINDOW_Y,NULL,NULL,h_instance,NULL);

	ShowWindow(hwnd,SW_SHOW);
	Game game = Game(hwnd);
	game.Run();

	FreeConsole();
}
LRESULT CALLBACK WinCallBack(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	if(msg == WM_DESTROY)
	{
		PostQuitMessage(0);
		return 0;
	}
	return DefWindowProc(hwnd,msg,wparam,lparam);
}
#endif __MAIN_H__